Imxrt1180 nxp evk lpadc&hyperflash#11529
Conversation
|
|
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
| MCUX_Config/pin_mux.c | ||
| MCUX_Config_LPADC1/clock_config.c | ||
| MCUX_Config_LPADC1/pin_mux.c | ||
| MCUX_Config_LPADC1/peripherals.c |
There was a problem hiding this comment.
这边还是有上次PR中提到的问题,麻烦SConscript中的src不用改,保持原来:
MCUX_Config/clock_config.c
MCUX_Config/pin_mux.c
| if GetDepend(['BSP_USING_QSPI_FLASH_FS']): | ||
| src += ['ports/drv_flexspi_nor_flash.c', 'ports/fal_flash_port.c'] | ||
|
|
||
| CPPPATH = [cwd,cwd + '/MCUX_Config',cwd + '/ports'] |
| #include <rtdevice.h> | ||
| #include <drv_gpio.h> | ||
| #include <fsl_rgpio.h> | ||
|
|
| { | ||
| } | ||
| #else | ||
| for(i=0;i<7;i++) { |
There was a problem hiding this comment.
代码需要格式化,可以查看rtthread仓库根目录下的.clang-format
There was a problem hiding this comment.
checked out formatting tool, reformatted the codes.
|
@Jason0204 麻烦请问一下我看提交了好几张图片,这个是准备写文档还是? |
|
|
||
| Command settings are consisted of group A and group B (GRPA, GRPB). GRPA is used for channel A1_4, A1_5, A1_7, while GRPB is used for channelB1_5, B1_6, B1_7. | ||
|
|
||
|  |
我为了写readme.txt, 记录变更和测试过程,让读者更清楚怎么更改和测试。 |
|
@Rbb666 lpadc 和 hyperflash 测试也都通过,麻烦merge。谢谢! |
|
@Jason0204 麻烦把package中的改动也PR到https://github.com/RT-Thread-packages/nxp-imxrt-sdk ,谢谢 |
ece1a8b to
6fca2f9
Compare
…A1_7) sampling demo based on CM33 core from XIP boot-up. eDMA4 is optional to offload CPU.
…n CM7 core. eDMA4 is optional to offload CPU.
6fca2f9 to
16e467f
Compare
|
@Jason0204 存在编译报错问题,还是需要解决下
|
There was a problem hiding this comment.
Pull request overview
This PR adds bring-up support for the imxrt1180-nxp-evk BSP covering LPADC1 (multi-channel + optional eDMA) on CM33 and HyperFlash (FlexSPI1 octal + optional eDMA) on CM7, largely relying on MCUXpresso Config Tools–generated low-level initialization.
本 PR 为 imxrt1180-nxp-evk BSP 增加板级支持:CM33 侧新增 LPADC1(多通道 + 可选 eDMA),CM7 侧新增 HyperFlash(FlexSPI1 octal + 可选 eDMA),并且大量依赖 MCUXpresso Config Tools 生成的底层初始化代码。
Changes / 变更点:
- Add LPADC1 driver updates with DMA-based multi-sample path and ADC vref/resolution reporting.
更新 LPADC1 驱动以支持 DMA 多通道采样,并补充 ADC 分辨率/Vref 查询接口。 - Add HyperFlash support path (FlexSPI LUT/OPI DDR sequences) and optional EDMA transfer integration.
增加 HyperFlash 支持路径(FlexSPI LUT/OPI DDR 指令序列)及可选 EDMA 传输支持。 - Introduce MCUX_Config generated sources/docs and CI attach configs for both features.
引入 MCUX_Config 生成代码/说明文档,并增加对应 CI attach 配置。
PR metadata checklist notes / PR 元信息检查:
- Title / 标题: current title doesn’t follow the required lowercase prefix format (e.g.
[nxp][imxrt] ...). Consider something like:
English:[nxp][imxrt1180] enable lpadc1 dma and hyperflash on imxrt1180-nxp-evk
**中文:**建议按仓库规范使用小写前缀,例如:[nxp][imxrt1180] enable lpadc1 dma and hyperflash on imxrt1180-nxp-evk - Description / 描述: the template bracket block (
[...]) and instructional text are still present; please remove the template text and keep only the actual PR description + test evidence.
描述中仍保留了模板方括号块和说明文字,建议清理,仅保留真实的变更说明与测试信息。
Reviewed changes
Copilot reviewed 29 out of 48 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| bsp/nxp/imx/imxrt/libraries/drivers/drv_lpadc.h | Adds board/channel notes (currently mostly commented). |
| bsp/nxp/imx/imxrt/libraries/drivers/drv_lpadc.c | LPADC enable/convert updated; adds DMA completion flow; registers ADC1. |
| bsp/nxp/imx/imxrt/libraries/drivers/drv_flexspi.c | Adds EDMA-based FlexSPI handle/callback and OSPI LUT variants. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm7/rtconfig.h | Enables cache + BSP feature macros (DMA/FLEXSPI/OSPI). |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm7/board/SConscript | Conditionally builds octal flash ops when BSP_USING_OSPI_FLASH is enabled. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm7/board/ports/flexspi_port.h | Adds CM7 FlexSPI/OSPI + DMA channel definitions. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm7/board/ports/flexspi_octal_flash_ops.c | Adds octal flash erase/read/program helpers (DMA + polling paths). |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm7/board/MCUX_Config_hyperFlash/readme.md | Adds HyperFlash setup/test documentation. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm7/board/MCUX_Config_hyperFlash/pin_mux.h | Generated pin mux header for HyperFlash scenario. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm7/board/MCUX_Config_hyperFlash/pin_mux.c | Generated pin mux source for HyperFlash scenario. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm7/board/MCUX_Config_hyperFlash/clock_config.h | Generated clock config header for HyperFlash scenario. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm7/board/MCUX_Config_hyperFlash/clock_config.c | Generated clock config source for HyperFlash scenario. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm7/board/Kconfig | Adds BSP_USING_OSPI_FLASH option under onboard peripherals. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm7/board/board.c | Adds TRDC permission setup and calls BOARD_CommonSetting() in init. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm7/.config | Enables DMA/FLEXSPI/OSPI_FLASH and cache-related config. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm7/.ci/attachconfig/ci.attachconfig.yml | Adds CI attach configs for HyperFlash (DMA/non-DMA). |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/rtconfig.h | Enables RT_USING_ADC + LPADC/DMA related BSP macros. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/board/MCUX_Config_LPADC1/readme.md | Adds LPADC1 routing/config/test documentation. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/board/MCUX_Config_LPADC1/pin_mux.h | Generated LPADC1 pin mux header. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/board/MCUX_Config_LPADC1/pin_mux.c | Generated LPADC1 pin mux source. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/board/MCUX_Config_LPADC1/peripherals.h | Generated peripherals header (ADC1 + DMA4 CH0). |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/board/MCUX_Config_LPADC1/peripherals.c | Generated peripherals init (LPADC + EDMA setup). |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/board/MCUX_Config_LPADC1/clock_config.h | Generated LPADC1 clock config header. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/board/MCUX_Config_LPADC1/clock_config.c | Generated LPADC1 clock config source. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/board/Kconfig | Adds LPADC/LPADC1/LPADC1_DMA Kconfig options. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/board/board.c | Calls BOARD_InitPeripherals() during board init. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/.config | Enables RT_USING_ADC and LPADC-related configs. |
| bsp/nxp/imx/imxrt/imxrt1180-nxp-evk/cm33/.ci/attachconfig/ci.attachconfig.yml | Adds CI attach configs for LPADC1 (DMA/non-DMA). |
| edma_config_t userConfig; | ||
| edma_handle_t dmaTxHandle; | ||
| edma_handle_t dmaRxHandle; |
| g_Transfer_Done = false; | ||
| EDMA_StartTransfer(&DMA4_CH0_Handle); | ||
| /* Wait for EDMA transfer finish */ | ||
| while (g_Transfer_Done != true) | ||
| { | ||
| } |
| // BOARD_InitLeds(); | ||
| BOARD_BootClockRUN(); | ||
|
|
||
| BOARD_InitPeripherals(); | ||
|
|
| for(i=0;i<7;i++) | ||
| { | ||
| #if (defined(FSL_FEATURE_LPADC_FIFO_COUNT) && (FSL_FEATURE_LPADC_FIFO_COUNT == 2U)) | ||
| while (!LPADC_GetConvResult(base, &mLpadcResultConfigStruct, 0U)) | ||
| while (!LPADC_GetConvResult(base, &mLpadcResultConfigStruct, 0U)) | ||
| #else | ||
| while (!LPADC_GetConvResult(base, &mLpadcResultConfigStruct)) | ||
| while (!LPADC_GetConvResult(base, &mLpadcResultConfigStruct)) | ||
| #endif /* FSL_FEATURE_LPADC_FIFO_COUNT */ | ||
| { | ||
| } | ||
| adc_result[i] = (mLpadcResultConfigStruct.convValue); | ||
| } |
|
|
||
| ### 2.1 pin configuration in MCUX_Config software | ||
|
|
||
|  |
|
|
||
| ### 3. FlexSPI1_b octal mode test | ||
|
|
||
|  |
| /* Enable all read/write/execute access for MRC/MBC access control. */ | ||
| (void)memset(&memAccessConfig, 0, sizeof(memAccessConfig)); | ||
| memAccessConfig.nonsecureUsrX = 1U; | ||
| memAccessConfig.nonsecureUsrW = 1U; | ||
| memAccessConfig.nonsecureUsrR = 1U; | ||
| memAccessConfig.nonsecurePrivX = 1U; | ||
| memAccessConfig.nonsecurePrivW = 1U; | ||
| memAccessConfig.nonsecurePrivR = 1U; | ||
| memAccessConfig.secureUsrX = 1U; | ||
| memAccessConfig.secureUsrW = 1U; | ||
| memAccessConfig.secureUsrR = 1U; | ||
| memAccessConfig.securePrivX = 1U; | ||
| memAccessConfig.securePrivW = 1U; | ||
| memAccessConfig.securePrivR = 1U; |


拉取/合并请求描述:(PR description)
[
LPADC:
these channels A1_4, A1_6, A1_7, B1_5, B1_6, B1_7 are routed to LPADC1 peripheral based on CM33 core from XIP boot-up, and multi-channel sampling is enabled with DMA. They are configured to VDDA_ADC_1P8 as VREFH source, full scale input(max 1.8V), you can check CM33/board/MIMXRT1180-CM33-ADC.mex and cm33/figures for more details.
all the configured channels are verified in msh, but drv_adc can only support A1_4, B1_5, A1_6 and A1_7, this is a limitation of driver.
HyperFlash:
[imxrt1180-nxp-evk] BSP: octal flexspi to drive hyper flash(MT35XU512) is supported by enabling FlexSPI1 and eDMA4, MCU_Config software is used for low-level configuration(pin_mux, clock).
为什么提交这份PR (why to submit this PR)
submit BSP development task for imxrt1180-nxp-bsp
你的解决方案是什么 (what is your solution)
LPADC:
HyperFlash:
请提供验证的bsp和config (provide the config and bsp)
LPADC:
HyperFlash:
LPADC:
CONFIG_BSP_LPADC1_USING_DMA=y
HyperFlash:
CONFIG_BSP_USING_DMA=y
CONFIG_BSP_USING_FLEXSPI=y
CONFIG_BSP_USING_FLEXSPI1=y
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up